title: SQL -How to add an auto incremental id in a auto generated temporary table
body: <p>I have a query like below and it generate a temporary table automatically based on parameter. So, the number of column of this table can be vary. Now , i need to add an auto incremental id column into this table.How i do it?</p>
  
  <pre><code>SELECT @SourceFields INTO ##StoreSourceInfo FROM testdb.dbo.@SourceTable
  </code></pre>
  
  <p>Note: 1) Number of source field &amp; name of table pass using the parameter <code>@SourceFields &amp; @SourceTable</code>.
        2) So, the number of column can be vary on ##StoreSourceInfo table.</p>
  
  <p><strong>Current Result:</strong></p>
  
  <p><code>select * from ##StoreSourceInfo</code> shows only the available column.</p>
  
  <p><strong>Expected Result:</strong> 
  <code>select * from ##StoreSourceInfo</code> query will show <strong>an additional auto incremental id column</strong> &amp; all rest of the column available in the temp table.</p>
  
  <p>Hope you get me. Thanks in advance.</p>