Sure. Just put $TableName in your query and it’ll be replaced with whatever value has been selected for the TableName template variable from the corresponding drop-down. http://docs.grafana.org/reference/templating/
Btw not sure why you prepend your variable name with an underscore. I don’t think there’s a rule against it, but underscore prefixes are generally used by Grafana’s internally defined variables.