Updated to properly determine column names

Updated to properly determine column names if there are more than 1
database on the server.