I currently do not have access to a server to test this out on, but how would I go about doing something like the following
UNPIVOT (X for XY IN (
SELECT column_name AS [XY]
FROM Information_schema.Columns
WHERE Table_name = XYZ AND column_name LIKE '[0-9][0-9][0-9][0-9]'
)) AS unpivotedData
i.e. is it possible to dynamically populate a list of columns to unpivot rather than statically declare them