title: Dynamically create temp table based on resultset from SP
body: <p>I have a SP that calls another SP and the resultset needs to be filtered to only the columns that I am interested in.</p>
  
  <pre><code>DECLARE @myTable TABLE
  (
    Field1 INT,
    Field2 INT,
    Field3 INT
  )
  
  --If someSP returns say 30 params and I need only 3 params, I don't want to declare all 30 in my temp table @myTable
  
  INSERT INTO @myTable
  (Field1, Field2, Field3)   
  EXEC someSP          --Need to selectively filter recordset from SP
    @InputParam1 = 'test'
  </code></pre>
  
  <p>If I cannot do this, I would want to create the temp table DYNAMICALLY based on the resultset from someSP (This way it relieves maintenance issues when someSP is modified to add a new param, I dont need to modify this proc as well</p>