CREATE PROCEDURE sm_test 
    @num int    
AS 
      declare @i int
      set @i=1
      while @i<=@num
      begin
      exec('alter table test add item'+convert(varchar(10),@i)+' int'  --注意item哪裡沒空格 
      end
GO