The Mishneh Torah, in Hilkhot Melakhim u-Milchamot 10:6-7[4-5], says:
ו [ד] בן נוח שבירך את השם, או שעבד עבודה זרה, או שבא על אשת חברו, או שהרג חברו, ונתגייר--פטור. הרג בן ישראל, או שבא על אשת ישראל, ונתגייר--חייב; והורגין אותו על בן ישראל, וחונקין אותו על אשת ישראל שבעל--שהרי נשתנה דינו.
ז [ה] כבר ביארנו שכל מיתת בני נוח בסיף--אלא אם כן בעל אשת ישראל נערה מאורסה, ייסקל, ואם בעלה אחר שנכנסה לחופה קודם שתיבעל, ייחנק
In English( based on Eliyahu Touger's translation):
6[4] A gentile who converts after cursing God's name, worshiping false gods, engaging in relations with a colleague's wife, or killing a fellow gentile is exempt from punishment.
In contrast, if he converted after killing a Jew or having relations with a Jew's wife, he is liable. He is decapitated for killing the Jew and strangled to death for engaging in relations with a Jew's wife. He is given the latter punishment because the laws governing him have changed.
7[5] It has already been explained that gentiles are always executed by decapitation except in cases when one engages in relations with the wife of a Jew while she is a consecrated maiden. In the latter instance, he is stoned to death.
If he engaged in relations with a Jew's wife after they married, but before they ever engaged in relations, he is executed by strangulation.
In short:
- If a Ben No'ach violated one of his laws, involving only himself( e.g. Avodah Zarah) or other Benei No'ach, if he converts, he is exempt from punishment.
- If he committed the violation against a Jew, even if he converts, he is punished:
- In general, he is executed by decapitation( by sword).
- If he engages in relations with the wife of a Jew:
- if while she is a consecrated maiden, he is stoned.
- if after she is married, he is strangled.
I edited the translation, and summarized, based on the Moachon Mamre edition's version. In printed text it says a Ben No'ach who converts is stoned for engaging "in relations with the wife of a Jew or a consecrated maiden"(אלא אם בעל אשת ישראל או נערה מאורסה יסקל).