Following snippet outputs the field names present in a mysql query:
for($i=0; $i<$fields_num; $i++)
{
    $field = mysql_fetch_field($result);
    echo  $field->name , ",";  
    //outputs something like ID,FirstName,OrderNbr etc..
}   
Obviously this only works with a mysql result handle ($result). 
How do you do the same thing when the statement handle is sqlsrv? 
EDIT: We all pretty much know that mysql out, and mysqli in. But the question is not about that.
 
     
    