In the Query Language Reference document found at https://developers.google.com/chart/interactive/docs/querylanguage#Table_used_in_Examples it indicates the following as properties of data tables.
"Identifier (or column ID). Used to reference columns within the query. Note that you should never try to reference a column by label in a query, only by identifier. Tip: Try not to use any IDs that include spaces; spaces are hard to manage and can cause you to make small, but hard to find mistakes, in your coding. Additionally, an ID that includes spaces must be surrounded by back-quotes."
Further on it shows the following example:
email address, name,
Finally at the very end of the document it says the following about identifiers: "Identifiers Identifiers (or IDs) are text strings that identify columns.
Important: If your identifier
Has spaces, Is a reserved word, Contains anything but alphanumeric characters or underscores ([a-zA-Z0-9_]), or Starts with a digit it must be surrounded by back-quotes (not single quotes).
Otherwise, your identifier does not need to be quoted. (Note that not all keywords defined by the syntax are reserved words; so, for example, you can use "max" as an identifier, without having to back-quote it.)
Examples: col1 employee_table
7 days traffic
I've searched for examples where someone was able to make this work and I haven't found any yet. As an interim solution to get my columns to move dynamically I've resorted to the following scheme.
This would be the original text. =query(Thurston!D1:AP41248,"select * where G>=18 and G<19",1)
Here is the replacement. =query(Thurston!D1:AP41248,"select * where " & char(column(Thurston!G1)+64) & ">=18 and " & char(column(Thurston!G1)+64) & "<19",1)
I put a reference in to the column in question and then computed what letter it would represent. Then if the column is moved the letter is updated automatically. It's not pretty but it works. It would be really convenient if I could get the identifiers as described to work.