title: Pass stored procedure parameter values to nested stored procedure without knowing parameter names
body: <p>I am trying to create a universal error trapping stored procedure that is called within all stored procedures and I need to get all parameter names (I can do this from system tables just knowing stored procedure name) and values.  </p>
  
  <p>The values is what I really need to obtain and get them dynamically (without having to specifically pass them to the stored procedure by name).</p>
  
  <p>Is there some way to pass a unique ID or some other thing to a nested stored procedure that I can use to get the parameter values for main stored procedure in nested stored procedure?</p>
  
  <p>Short example: I have a stored procedure:</p>
  
  <pre><code>create PROCEDURE testParamaters
      @text1 VARCHAR(500),
      @DateTime1 DATETIME
  AS
  
  -- I want to be able to call an SP something like this:
  EXEC DynamicErrorTrackingSP (pass something, system variable/data/etc, so I can 
                               dynamically get all parameter values in nested SP)
  </code></pre>
  
  <p>I currently have code similar to this and it works fine (but it will have to be edited for every SP to correctly pass the parameter values (I do not want to have to edit it for every SP).</p>
  
  <pre><code>EXEC DynamicErrorTrackingSP @ParmaterNameValuePairs = 
       '@text1 = ' + @text1 + ', @DateTime1 = ' + cast(@DateTime1 as varchar(500)) + ''
  </code></pre>