Get column count for a given query