As its a FAQ here's an example:DECLARE @MyOutputParameter int, @SomeID intSELECT @SomeID = 1234EXEC sp_ExecuteSQL N'SELECT @MyOutputParameter = MyColumn FROM MyTable WHERE MyID = @SomeID', N'@MyOutputParameter int OUTPUT, @SomeID int', @MyOutputParameter = @MyOutputParameter OUTPUT, @SomeID = @SomeIDSELECT [@MyOutputParameter]=@MyOutputParameter
Both OUTPUT parameters, in the call to sp_ExecuteSQL, are requiredSee also: http://support.microsoft.com/kb/262499