Problem connect to a different server then do sudo login and finally run some scripts and get result

I have to write a shell script in my current linux server and I have to connect to a different server then do sudo login and finally run some scripts residing in a particular directory and get results back. I am starting to write my shell script as below but after I do ssh login it prompts for password and shows command prompt and script halt there and script does not proceed further.

SERVER_IP=10.00.000.00
SV_INSTANCE_NAME=abcxyz1b
...
..

# ssh to SV server_ip
ssh xusername@$SERVER_IP

# sudo login to instance
sudo su - $SV_INSTANCE_NAME

...
..

I wish to know is this the right way to connect and run script residing in a different server or there can be some better to do what I wish to achieve.

Have you looked at this thread?: How to connect unix server to unix server through shell scripts

Don,
In the link which you mentioned there is no mention of how to handle the running of the script if you have to login as sudo on that server