What do you mean by "recover"?
Your SMS messages are stored in a database buried in a hidden system folder.
There is no undelete of deleted messages.
There is no undelete of a deleted database file due to a factory reset or the like.
There are apps that can be installed to do backup and restore for your SMS messages.