A SIM, or Subscriber Identity Module, card is a computer chip inside a cell phone which identifies your device to your service provider. SIM cards can contain up to 128 KB of memory to store things like contacts, phone numbers, text messages, data usage and billing information. The storage of this information is what makes SIM cards and service interchangeable between devices. Text messages could be stored on a SIM card temporarily or permanently, depending on your phone settings.
Temporary Storage
Video of the Day
When you delete a text message, it is not immediately removed from your device. The encrypted technical message data remains stored on the SIM card, but is marked to be overwritten. The encrypted technical message data remains on the phone until enough new data has been stored to overwrite it. If the messages are downloaded directly to your device, this can mean that several hundred "deleted" texts remain.
Video of the Day
User Settings
Some mobile phone models may allow you to save selected messages to your SIM card for future recovery. To maximize privacy, you can also change the temporary data storage settings on some devices so that once you delete a message, it is gone forever. Unless otherwise configured, it is safe to assume all of your data -- including photos, videos, call history and texts -- is temporarily stored on the SIM card.
Spying Devices
SIM card reading devices can decrypt the message data stored on SIM cards, including "deleted" messages that are marked for overwriting. Some devices store text messages directly on the phone's hard drive, which require a more technically challenging recovery process. Cell phone forensic specialists use advanced techniques to recover data from cell phones to help police uncover incriminating evidence.
Carrier Storage
Service carriers store all data and text messages sent through their network temporarily, with the length of time varying between service providers. A 2008 Slate.com report claims AT&T Wireless stores them for 48 hours, Sprint for up to two weeks and specialized government providers like SkyTel, permanently. It would be impossible for a large carrier to permanently save the enormous amount of data sent through its networks, but you should be able to recover data by contacting the carrier if the message was sent within its storage timeline.