• Win, as he has stated, he (or any user from Server B) does not have access to server A (publisher and distributor). So, they cannot query the replication metadata tables (that you pointed out).

    In that scenario, you can ask the adminstrator on Server A to configure a Replication:Agent Success alert which will send an email. He can add you as an operator (or recipient) and you can recieve an email once the distribution agent completes work. Upon recieving the email, you can execute it on the server.

    Or, you will need to ask the admin on server B to create a stored procedure that can query (SELECT) the replication metadata tables (namely distribution..msdistribution_history) and expose it as a webservice. You can then execute this webservice which will tell you when the distribution agent completed sync and then you can execute your code on server B.

    OR your SP on server B will need to be executed from Server A as a 4-part (or distributed) query. You can add this as an extra jobstep in the distribution agent job step.