One way is mentioned here. How to back up your media in iTunes
or here: Transferring your iTunes Library
Syncing to a new iTunes library or computer will erase your iPhone. Only if you back up your iPhone manually before syncing, you can restore your device from that backup again. A manual backup does not include the sync process.
Disable autosync in iTunes, connect your iPhone to your new computer and right click on it in the device list and choose backup. iTunes will backup your ipod without syncing.
Transfer your purchases the same way, choosing "transfer purchases" this time.
When you connect your iPhone for the first time, all media content will be erased. But you can restore your settings and app data from your manual backup afterwards.
Don't forget to set up at least one contact and event on your new computer to be able to merge calendars and contacts when you sync the phone for the first time.
Music is one way only, from the computer to your device, unless you bought the songs in itunes and transferred your purchases.
There is 3rd party software out there, but not supported by Apple, see this thread:http://discussions.apple.com/thread.jspa?threadID=2013615&tstart=0
About backups and what's saved: iTunes: About iOS backups
How to back up and restore:http://support.apple.com/kb/HT1414
How to download apps for free again:http://support.apple.com/kb/HT2519
Saving other data is also described here. How to back up your data and set up as a new device