As mentioned, this can't be done as you are imagining, as data is stored in tables, and the catalog views (sys.
) contain information about database objects.
You can achieve what you're after with a cursor and dynamic sql:
DECLARE @col VARCHAR(MAX)
,@table VARCHAR(MAX)
,@schema VARCHAR(MAX)
,@strSQL VARCHAR(MAX)
DECLARE xyz CURSOR
FOR
SELECT c.name
,t.name
,s.name
FROM sys.tables t
JOIN sys.columns c
ON t.object_ID = c.object_ID
JOIN sys.schemas s
ON t.schema_id = s.schema_id
WHERE c.name LIKE '%EmployeeID%';
OPEN xyz
FETCH NEXT FROM xyz
INTO @col,@table,@schema
WHILE @@FETCH_STATUS = 0
BEGIN
SET @strSQL =
'UPDATE '+@schema+'.'+@table+'
SET '+@col+' = ''Something''
'
PRINT (@strSQL)
FETCH NEXT FROM xyz
INTO @col,@table,@schema
END
CLOSE xyz
DEALLOCATE xyz
GO
It's a good idea to test dynamic sql with the PRINT
command before actually running it via EXEC
.