Sorry, but not clear:
"My question is how can I make the "connection name" parameter inside the formula dynamic instead of being hard coded?"
Which formula you are talking about?
In general you can use Model name as connection name, please read help: 33.1 Connection Name Parameter - Syntax
Vadim
P.S. And EPMSaveData is not a good idea...