It can be done as dynamic, but that in no way makes it a good idea. If you need the totals for other shuff, then
Create proceduretest1
As
begin
Declare @col1total int, @col2total int, @col3total int;
select @col1total = sum(col1), @col2total = sum(col2), @col3total = sum(col3) from Table1;
/* do other stuff with totals here*/
select @col1total, @col2total, @col3total;
end
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability