I am trying to optimize a stored procedure to improve overall performance. Currently the design has multiple temp tables with the last column designed to perform aggregate functions (such as SUM) on fields it draws data from. I am trying to optimize a stored procedure to i