I have a stored procedure that dynamically produces pivot results, passing sql for row defs, column to pivot, aggregate(field) to sum, and table name of aggregate. This works great, but i need to produce a table from these results to use in further calculations.
How can I dynamically save the results to a table within the stored procedure (temp or non temp) without knowing the output columns??