How to …
See here one way to unpivot, thanks to Michael J Swart, let say, a generic way to unpivot.
And in comments, it’s a way that I like, with the help of a JSON.
It’s a combination between FOR JSON cu OPENJSON.
FOR JSON will give, let say, a string/array/combination between columns and values;
and OPENJSON will do the magic, will return rows having the desired output, having the unpivot result set.
FOR JSON AUTO , WITHOUT_ARRAY_WRAPPER , INCLUDE_NULL_VALUES
+ OPENJSON
S
AKA sababa