I have the following table:
column_name | a | b
--------------------
     a      | 0 | 1 
--------------------
     b      | 2 | 3
Is it possible to write a select statement that will return:
result
------
   0
   3
(I want to pick a column depending on the name specified in column_name)
The trick is that I do not know how many columns will I have and what will be their names (except for the column_name column)
I can't create temporary tables, functions and so on. Yes, it's a part of a task on a SQL course on my university, still not the task itself, so I believe I can ask for help here.

EXECUTEcommand. Or maybe you are looking for crosstabulation / pivot, in which case you want thecrosstabfunction from thetablefuncextension.