Query INFORMATION_SCHEMA or equivalent SQL meta data to obtain column names and types for a table.
Useful links