title: To insert the result of sp_executesql into a temp table
body: <p>I am using a dynamic query in SQL which returns me a large data set which  I need to insert into a temporary table.</p>
  
  <p>Does 
      SELECT INTO #tmp from EXEC sp_executesql @query work?</p>
  
  <p>I did try it out but I get an error 'Incorrect syntax near the keyword 'EXEC' </p>
  
  <p>I know that it works using Insert into, but I don't want to create the table manually as it is a large table with a lot of columns. Is there an alternative without having to creating the temp table manually?</p>