title: How to use string as column name in Bigquery
body: <p>There is a scenario where I receive a string to the bigquery function and need to use it as a column name.
  here is the function</p>
  <pre><code>CREATE OR REPLACE FUNCTION METADATA.GET_VALUE(column STRING, row_number int64) AS (
  (SELECT column from WORK.temp WHERE rownumber = row_number)
  );
  </code></pre>
  <p>When I call this function as <code>select METADATA.GET_VALUE(&quot;TXCAMP10&quot;,149);</code> I get the value as <code>TXCAMP10</code> so we can say that it is processed as <code>SELECT &quot;TXCAMP10&quot; from WORK.temp WHERE rownumber = 149</code> but I need it as <code>SELECT TXCAMP10 from WORK.temp WHERE rownumber = 149</code> which will return some value from temp table lets suppose the value as <code>A</code></p>
  <p>so ultimately I need value <code>A</code> instead of column name i.e. <code>TXCAMP10</code>.</p>
  <p>I tried using execute immediate like <code>execute immediate(&quot;SELECT&quot; || column || &quot;from WORK.temp WHERE rownumber =&quot; ||row_number)</code> from <a href="https://stackoverflow.com/a/62145107/7406635">this stack overflow post</a>  to resolve this issue but turns out I can't use it in a function.</p>
  <p>How do I achieve required result?</p>