Does the file ALWAYS write?

have you tried launching it with the /F switch (shouldn't really be required, but looking to cover all bases here)

Perhaps put in some @ScriptExe and @ScriptDir and @ScriptName

It is potentially possible that your REPLICATION is not current. In the past I've had a DC that was not replicating correctly so it always had an OLD script.

Is it possible to confirm 100% that all DC have an up to date version of your script?

Also maybe put in some @ERROR lines as well.