Your iPhone generally will remain synced with your messages in your computer's email program, as well as your SMS text message count if you use a service such as Google Voice to send text messages to multiple devices. When your message count is demonstrably incorrect based on another device, the most likely reasons are incorrect mail settings or minor corruptions in your iPhone message databases.
Email Access Type
Email has two primary methods of providing access to online accounts: POP and IMAP. POP, by default, downloads all email messages from the server and deletes them immediately, so your email appears in only one location. IMAP synchronizes your email programs with your online accounts and deletes messages only when you manually do so. You should use IMAP when you use multiple devices to check your email, as this will keep all of your devices properly synchronized. If one of your email programs downloads messages using POP, these messages will not be available to other devices and your message counts will vary by device.
Email Account Setup
Your iPhone message databases can also become temporarily out of sync if your iPhone erroneously counts a message as new or saved after it has been deleted. In many cases, this problem will correct itself after a few more synchronizations. If you have a persistent message being counted in your iPhone Mail software, you can manually correct this problem by deleting the account in the Settings app under the Mail tab, then setting up the account again. This will delete the internal mail databases and download them again fresh from the servers, which should fix problems with out-of-sync message counts.
Video of the Day
Under normal circumstances, SMS text messages will send only to a specific cell phone based on the phone number you give out to receive them. However, it is also possible to use Google Voice or other SMS forwarding services to send your text messages to multiple devices. As with email, an out-of-sync SMS database will modify itself after subsequent syncs to keep itself up-to-date with online storage. You can also use iPhone applications that talk directly to your SMS forwarding service to bypass the iPhone Messages app.
Apple introduced iMessage in iOS5; it allows iOS users to send text messages to either cell phones or email addresses. This allows owners of an iPod touch or an iPad to send and receive text messages to users of iPhones, even though there is no phone number associated with their own devices. This can cause some confusion, as some messages will be sent using SMS and others will be sent by the iMessage system. Furthermore, iMessages may be sent to different devices if multiple iOS devices are set up with the same Apple account. iPhones will display SMS and iMessage texts in the same application, so this should not cause changes in the unread message count. However, if iMessages are going to the wrong device, use the Settings app to change the iMessage email addresses in other iOS devices to make sure that other devices are not registered to the same address; this will prevent iMessages from being routed to the wrong device when both are turned on.