Berhanie is right, the way to this is public/private key.
However, what is the purpose of it? What does your script do after you have an SSH connection and you have a remote shell opened? What else can you do on a remote machine in a script?
If it is file transfer, consider sftp or rsync. If it is something else, wouldn't it be possible to run the script itself remotely?
Using an automated SSH login thru a script *is* a security hole, it is not for nothing that you always need to key in a password (you cannot store that), or have to use public/private keys so that passwordless is possible only from dedicated machines.