Changing execution profile at runtime depend on condition

Hi I am trying to assign execute profile as before test set up.
in my script, pipeline will provide me an url and if url contains naming as staging or integration I will execute respected profile.
@SetUp(skipped = false)
def setUp() {
String Url = GlobalVariableURL
if (Url.contains(‘staging’)){
I checked the discussions below but they do not have a solution for my case

Katalon Studio doesn’t provide you a way to change Execution Profile runtime.

We need to develop our own way. Here is my solution: