Disclaimer : This is maybe not the most efficient way to do it, but more something like an intuition on how to do it.
Last try :
=textjoin(",",true, ArrayFormula(char(64+unique(transpose((split(textjoin(",",true, ArrayFormula(if(REGEXMATCH(A1:Z100,"Adam"),COLUMN(A1:Z100),))),","))) )) )) Use this formula in your query like this :
=query( range , "Select "& (the formula) & " Where [..]")
Credit to [this answer (how to get a column's address)][1] [1]: https://webapps.stackexchange.com/a/135613/222777this answer (how to get a column's address)