שולחן ערוך, יורה דעה של״ח
Shulchan Arukh, Yoreh De'ah 338
וידוי החולה וכיצד אומרים לו. ובו ב' סעיפים:
נטה למות אומרים לו התודה ואומרים לו הרבה התודו ולא מתו והרבה שלא התודו ומתו ובשכר שאתה מתודה אתה חי וכל המתודה יש לו חלק לעולם הבא ואם אינו יכול להתודות בפיו יתודה בלבו (ואם אינו יודע להתודות אומרים לו אמור מיתתי תהא כפרה על כל עונותי) (טור) וכל אלו הדברים אין אומרין לו בפני ע"ה ולא בפני נשים ולא בפני קטנים שמא יבכו וישברו לבו:
נטה למות אומרים לו התודה ואומרים לו הרבה התודו ולא מתו והרבה שלא התודו ומתו ובשכר שאתה מתודה אתה חי וכל המתודה יש לו חלק לעולם הבא ואם אינו יכול להתודות בפיו יתודה בלבו (ואם אינו יודע להתודות אומרים לו אמור מיתתי תהא כפרה על כל עונותי) (טור) וכל אלו הדברים אין אומרין לו בפני ע"ה ולא בפני נשים ולא בפני קטנים שמא יבכו וישברו לבו:
If one feels death approaching, he is instructed, 'Confess [your sins]!' And they say to him, 'Many confessed [their sins] and died not, and many who have not confessed, died; and as a reward, should you confess, you will live; and he who confesses [his sins] has a portion in the world to come.' And if he is unable to make confession with his mouth, he should confess in his heart. If he knows not what to confess, they instruct him, say, 'My death should be an expiation for all my sins.' All these instructions are given to him, not in the presence of illiterate people, nor women, nor minors, lest they cry and break his heart.
סדר וידוי שכיב מרע מודה אני לפניך ה' אלהי ואלהי אבותי שרפואתי ומיתתי בידך יהי רצון מלפניך שתרפאני רפואה שלימה ואם אמות תהא מיתתי כפרה על כל חטאים ועונות ופשעים שחטאתי ושעויתי ושפשעתי לפניך ותן חלקי בגן עדן וזכני לעוה"ב הצפון לצדיקים. (ואם רוצה להאריך כוידוי יו"כ הרשות בידו) (כל בו):
The order of confession for a dangerously ill person, is, 'I confess before Thee O Lord, my God and the God of my fathers, that my healing and my death are in your hand. May it be Thy will, to heal me completely, and if I die, my death should be an expiation for all sins, wrongs and rebellious acts, which I have committed sinfully, wrongfully and rebelliously before Thee, and grant me a share in Paradise, and favour me with the world to come which is stored away for the Righteous.' And if he desires to prolong as in the confession for the Day of Atonement, he has the right to do so.
Ashlei Ravrevei: Shulchan Aruch Yoreh Deah, Lemberg, 1888 (Public Domain) · Code of Hebrew Law by Chaim N. Denburg, Montreal, 1955 (CC-BY) · 2 se'ifim