With this query, I get all tables that contains column named "Status_ID"
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 'Status_ID'
Data in Status_ID
may only have values from 1 to 6.
What I want is to get a list of all tables, where Status_ID = 2
at least once.
(Exclude all tables from the code above, that do not contain data with Status_ID = 2
)