title: sql add column with variable names
body: <p>Is there any way to add variable number of columns to a table.</p>
  
  <p>I am trying below but no success.</p>
  
  <pre><code>DECLARE @VAR INT = 1
  WHILE @VAR &lt;=20
  BEGIN
      DECLARE @COLUMN VARCHAR(MAX) = 'COLUMN_'+CAST(@VAR AS VARCHAR)
      IF NOT EXISTS(SELECT 1 FROM SYS.columns WHERE OBJECT_ID = OBJECT_ID('MY_TBL') AND name=@COLUMN )
          begin
          ALTER TABLE MY_TBL ADD @COLUMN NVARCHAR(3) NULL;
          end
      SET @VAR += 1
  END
  </code></pre>