• Just to add to what David McKinney already said - a simple example of how to use the OPENROWSET that makes use of the possibilities offered in the article without wrapping into a stored procedure:

    USE master

    SELECT *

    FROM OPENROWSET('SQLOLEDB','SERVER=.;Trusted_Connection=yes','SET FMTONLY OFF EXEC sp_lock') ORS

    LEFT OUTER JOIN (VALUES

    ('S', 'Shared'),

    ('IS', 'Intent Shared')

    ) LockExpl(Mode, ModeText)

    ON ORS.Mode = LockExpl.Mode