title: Retrieve column names and types of a stored procedure?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/7368864/retrieve-column-definition-for-stored-procedure-result-set">Retrieve column definition for stored procedure result set</a>  </p>
  </blockquote>
  
  
  
  <p>I use the following SQL to get column names and types for a table or view:</p>
  
  <pre><code>DECLARE @viewname varchar (250);
  
  select a.name as colname,b.name as typename 
  from syscolumns a, systypes b -- GAH!
  where a.id = object_id(@viewname) 
  and a.xtype=b.xtype 
  and b.name &lt;&gt; 'sysname'
  </code></pre>
  
  <p>How do I do something similar for the output columns of a stored procedure?</p>