Dynamically get all parameter values in stored procedure
<p>Is there any way to get all parameter values from a stored procedure dynamically?</p>

<p>In other words, iterate through all parameters in one stored procedure to get their values into one string. This is for a unified logging process for a bunch of stored procedures.</p>

<p>I can get the names of parameters:</p>

<pre><code>SELECT PARAMETER_NAME 
FROM INFORMATION_SCHEMA.PARAMETER
WHERE SPECIFIC_NAME = 'procedure_name';
</code></pre>

<p>Also, I tried to use dynamic SQL commands. I've generated a command with included parameter, but EXEC can't execute command.</p>

<pre><code>@cmd = 'SELECT '@UserID' + CONVERT(NVARCHAR(MAX), @UserID) 
             + '@Date' + CONVERT(NVARCHAR(MAX), @Date)'
EXEC @cmd
</code></pre>

<p>Is there any way to do this besides manually generating a list of parameter values for each stored procedure?</p>