That SQL is part of an R package, which uses another package called SqlRender to fill in the parameters you see. I would recommend you use the R package instead of the SQL.
SqlRender actually comes with a Shiny app. You can copy-paste the SQL into this app and see how it is translated to the various SQL dialects, once you fill in the parameters.
sourceName appears to be some name used to create unique table names.
I know that there are several groups in OHDSI now working on building new treatment pathway applications, but I'm not sure who exactly. Anyone?