This issue is discussed practically in Shut MiMa'amakim 2:4. (Shut MiMa'amakim (lit. "from the depths", cf Psalms 130:1) are the responsa of Rabbi Ephraim Oshri written between 1941 and 1945 in the Kovno Ghetto.) He writes that on the cold, rainy day of the Great Action when all the Jews were being rounded up for inspection, a Jew named Eliyahu הי"ד from Warsaw approached him and asked him what the proper nussach of the blessing on Kiddush Hashem is so that not only could he say it when his time came, but he could fulfill one last mitzva in this world by telling the others with him what the proper halacha is.
In the responsum, Rav Oshry quotes a few different versions of the blessing, and concludes by telling Eliyahu to follow the version of the Shela (Shaar Otiot Alef, which is quoted by Pitchei Teshuva YD 156:7) which is:
ברוך אתה יקוק אלוקינו מלך העולם אשר קדשנו במצותיו וצונו לקדש שמו ברבים
Eliyahu practiced the blessing and went off to go teach it to others. Later on he returned to Rav Oshry and reported that Rav Elchonon Wasserman before he was killed by the Nazis a few months prior told his son Naftali that the Chafetz Chayim had told him to use the same version of the blessing given by the Shela above.
May we never need to recite it again.