All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His Slave and Messenger.
If you were a Muslim at the time of marriage contract, then you should know that the presence (and consent) of the Wali (bride's guardian) is a condition for the validity of the marriage contract according to the preferred opinion of the jurists; please refer to Fatwa 83629.
If a non-Muslim woman turns Muslim and does not have a Muslim guardian, then organizations such as Islamic centers which examine the affairs of Muslims should stand in as her Wali. If there is no such organization, then she should appoint a trustworthy Muslim man as her Wali as we have already clarified in Fatwa 83008.
Thus, if it was the Imaam of the Masjid who stood in as your Wali [and you were Muslim], then the marriage is valid. But if his role was only to dictate to you the words that you should utter and you married yourself off by yourself, then the marriage is invalid. However, the children born out of this marriage are to bear their father's name because there is some dubiousness in the case as clarified in Fatwa 126168.
On the other hand, if you were a non-Muslim at the time of marriage contract], then we would like to stress that it is not permissible for a Muslim man to marry a non-Muslim woman unless she is both from the People of the Book and chaste. For more details, kindly refer to Fatwa 84456.
In any case, if you wish to continue the marriage, then it is obligatory to renew the contract in a correct and valid manner. For more benefit, please refer to Fatwa 126160.
Allaah Knows best.