好记性不如烂笔头。

存储过程执行带输出参数的SQL语句

create proc proc_Test
@recordCount int out
as
begin
declare nvarchare(max) @sqlText='select @rows=count(*) from TableName'
exec sp_executesql @sqlText,N'@rows int output',@recordCount out
end