"Outfields - You must list the actual field names rather than the alias names... However, you are able to use the alias names when you display the results. You can set field alias names in the map document"
All of the samples use hard-coded alias names, eg:
Does anyone know the syntax to retrieve the field alias programatically from the ArcGIS Server services endpoint?
ie, rather than hard-coding 2000 Population, how could you retrieve it from the ${POP2000} parameter? I'm trying to write a generic query function which can be used by multiple layers, with different schemas.