SELECT c.name AS 'ColumnName'
,t.name AS 'TableName'
FROM sys.columns c
JOIN sys.tables t ON c.object_id = t.object_id
WHERE (c.name LIKE '%SalesOrderID%' OR c.name LIKE '%RevisionNumber%')
AND t.name = 'SalesOrderHeader'
ORDER BY TableName
,ColumnName;
USE Testus
GO
SELECT sys.objects.name AS TableName
FROM sys.objects
INNER JOIN sys.columns AS columns1 ON columns1.object_id = sys.objects.object_id
INNER JOIN sys.columns AS columns2 ON columns2.object_id = sys.objects.object_id
WHERE (sys.objects.type = 'U')
AND (columns1.name = 'SalesOrderID')
AND (columns2.name = 'RevisionNumber')
ORDER BY TableName