title: Pass one query value to another query in SQL Server
body: <p>I need to pass one query values to another query as &quot;table name&quot; and &quot;column name&quot; like below</p>
  <pre><code>SELECT Value1 AS [MyTableName],Value2 AS [MyColName]
  FROM MyTable
  </code></pre>
  <p>Pass the above result to below query as follows.</p>
  <pre><code>SELECT * FROM [MyTableName]
  WHERE ColumnValue = MyColName
  </code></pre>
  <p>In this case MyTableName is Value1 from the above result and MyColName is Value2.
  Is it possible to combine the above result into a single query.</p>