DECLARE @SearchColumnName nvarchar(255) DECLARE @SearchColumnType nvarchar(255) DECLARE @SearchTableName nvarchar(255)
-----------------------------Search values--------------------------------------------
SET @SearchColumnName ='%propertynumber%'
SET @SearchColumnType = '%%'
SET @SearchTableName = '%%'
------------------------------The Code-------------------------------------------
SELECT t.name AS 'TableName',
c.name AS 'ColumnName',
y.name as 'DataType'
FROM sys.columns c
JOIN sys.tables t ON c.object_id = t.object_id
JOIN sys.types y ON y.user_type_id = c.user_type_id
WHERE c.name LIKE @SearchColumnName
AND y.name LIKE @SearchColumnType
AND t.name LIKE @SearchTableName
ORDER BY TableName ,ColumnName;