title: How can we add database table column dynamically based on other table values in Sql
body: <pre><code>CREATE PROCEDURE sproc_BuildTable 
            @TableName NVARCHAR(128)
            ,@Column1Name NVARCHAR(32)
            ,@Column1DataType NVARCHAR(32)
            ,@Column1Nullable NVARCHAR(32)
     AS
  
     DECLARE @SQLString NVARCHAR(MAX)
     SET @SQLString = 'CREATE TABLE '+@TableName + '( '+@Column1Name+' '
     +@Column1DataType +' '+@Column1Nullable +') ON PRIMARY '
  
     EXEC (@SQLString)
  
     GO
  </code></pre>
  
  <p>I want to create a New table,The table column names are need to be add dynamically based on other database column values</p>