My stored procedure has an output parameter for row count. When the stored procedure is called using Dapper...
var p = new DynamicParameters();
p.Add("@rowCount", dbType: DbType.Int32, direction: ParameterDirection.Output);
var reader = conn.ExecuteReader("SearchStuff", p, commandType: CommandType.StoredProcedure);
the profiler shows the following...
declare @p0 int
set @p0=115
exec SearchStuff @rowCount=@p0 output
select @p0
I'm baffled... how is the row count assigned to the out parameter before the stored procedure has been executed?
The text you see in the trace is a reverse engineered version of the RPC completed event, not what actually got executed. This looks to be an issue with the way SQL Trace/Profiler displays the human readable format.
SQL Server is fast but doesn't yet warp time :-)