I played around with this a bit out of curiosity and the stumbling block seems to be the stdin redirection to sudo. For example, the following works fine:
ssh -t user@host sudo -u user <command>
Any attempts I used to change the command to include redirection would not work.
I also tried ideas similar to this with no luck
cat /path/to/local.sh 2>&1| ssh -t user@host sudo -u user <&1
I couldn't locate any details specific to sudo not working with redirection but that appears to be the main issue from my testing. I tried various switches with ssh and sudo like ssh -t and sudo -S or sudo -n, but was not able to get a combo that worked.
Any reason you cannot copy the script to the destination machine instead of trying to run it from a local location?
It is useless to pass the filename into ssh, because the remote system cannot use the filename.
This may be a catch-22 because you need standard input to input passwords to sudo, but if stdin is occupied, you have no way to pass in the script. ssh is less of a problem because it can open /dev/tty to talk to you directly, but the sudo on the remote end can't do that.
If ssh and sudo are both configured for passwordless use: