declare @i1 int, @i2 int,@Sql1 nvarchar(max) set @Sql1 = N'select @i1 = 1,@i2 = 2' exec sp_executesql @Sql1, N'@i1 int out, @i2 int out', @i1 out, @i2 out print @i1 print @i2