Use sudo with password as parameter

I would like to run sudo with my password as parameter so that I can use it for a script. I tried sudo -S mypassword execute_command but without any success. Any suggestions?