What's the easiest way for me to retrieve a list of stored procedures that a named Windows NT login account owns and that Enterprise Manager displays? I want to wrap code around the list, run the code in Query Analyzer, then change the object owner to dbo. Would translating an NT login account to the SID and joining sysxlogins to the sysobjects or sysdatabases system table help?
Master.dbo.sysxlogins exposes the SID-to-name mapping for valid logins. So, you can easily write a join query that uses sysxlogins to retrieve login names, then find matching objects such as stored procedures in a database.