It's easy to write out the headers prior to your data, with hard-coded columns names:
<connection id="out" driver="csv" url="myreport.csv"></connection>
<script connection-id="out"> <!--Writing header -->
MYCOL1, MYCOL2, MYCOL3
</script>
But it sounds like you'd like to dynamically get that from the table. I'm not sure if this is so much a Scriptella question as a SQL question. I'm not sure how go query a DB and get column names.