<?php global $wpdb; $table_name = $wpdb->prefix . 'posts'; foreach ( $wpdb->get_col( "DESC " . $table_name, 0 ) as $column_name ) { error_log( $column_name ); } ?>
It will result in something like the following being printed to your debug.log
ID
post_author
post_date
post_date_gmt
post_content
You have done, Enjoy the WordPress coding.