I don't use the CSV in the DBD module but these should still apply.
You can get the column names of a statement using the statement attribute NAME, NAME_uc or NAME_lc. EX:
my $dbh = (... however you connect...);
my $stmt = qq(select * from table);
my $csrStmt = $dbh->prepare($stmt);
my @cols =...