I'm also looking for similar requirement. We are facing many challenges when moving from Oracle to TD, specially on these little things.
Appreciate any ideas ???
What is the platform you are using to trgger teradata? Is it Unix or someting else?
If unix you have a parameter 'hostname' which gives you the environment server on which it is trigerred. By that you can write your code.