title: how to find index of a row in sql server?
body: <p>How can i fetch column names from a table on index basis, like I want to make a tables whose column name should be the name of last column fields of a result set of a query, but those result sets last columns value may be different at different execution time, so i want to know how can i fetch those index value of that last column to make a temp table with column name of those last columns value of a result set.
  Is there any way/function in sql server to dynamically form that?  </p>