I'm trying to get whatever a stored procedure returns, with the column names and their types. I can do this with tables but I couldn't figure it out for stored procedures. I tried the sp_columns
but only managed to make it work for tables.
I have also tried something like this but I'm not sure what I am supposed to match with what.
SELECT *
FROM SYS.PROCEDURES (NOLOCK) AS AA
INNER JOIN SYS.SCHEMAS (NOLOCK) AS BB ON (AA.schema_id = BB.schema_id)
INNER JOIN SYS.COLUMNS (NOLOCK) AS CC ON (AA.object_id = CC.object_id)
For example:
USER_ID VARCHAR(200)
I only need the names of the column names a stored procedure returns and their data types. SQL Server version is 2014, if it matters.
Any ideas? Thanks.