http://support.apple.com/kb/HT4946 See section: iTunes and encrypted backups.
Warning: If you encrypt an iPhone backup in iTunes and then forget your password, you will not be able to restore from backup and your data will be unrecoverable. If you forget the password, you can continue to back up and use the device, however you will not be able to restore the encrypted backup to any device without the password. You do not need to enter the password for your backup each time you back up or sync.
If you cannot remember the password and want to start again, you must perform a full software restore and when iTunes prompts you to select the backup from which to restore, choose set up as a new device.
It appears that many people have experienced different outcomes. However, per this article, if you restore from a backup that has an encrypted passcode, then that passcode is a part of the backup and will reappear after the restore is complete. The only way to work around this is to restore as a new device.