In SQL Server, the sys.dm_exec_describe_first_result_set_for_object
dynamic management function returns the metadata of the first result set for a given module.
It takes an @object_id
as a parameter and describes the first result metadata for the module with that ID.
It uses the same algorithm as the sp_describe_first_result_set
system stored procedure and the sys.dm_exec_describe_first_result_set
function, and does pretty much the same thing, except that it’s limited to just stored procedures and triggers.
If you pass the ID of a different object type (such as a view, function, table, etc) then it will return an error.
Continue reading