R Shlomo Zalman Auerbach and most left of him held that yes, right from him it is a subject of some debate - R Menashe Klein held that they aren't
The shaila is about which type of soldiers did RSZ say this.
1) Soldiers ranging from Nachal Charedi, Chardal, Mizrachi/Dati Leumi and anyone who is a Ma'amin.
2) Soldiers who aren't Ma'aminim but are fighting to to save Am Yisrael.
3) A category which was mainly at the beginning and before the creation of the State, fighting in order to create a secular state and replace the the weak Jew in the Shtetl in Eastern Europe with the Zionist.
I am in doubt about the soldiers in Category 2 as they are doing something noble but without doing it Leshem Shamayim - so I am unsure if that can make someone a Kadosh, but about Category 3, I quote the Gemara in Avoda Zara 2b:
דאמר להם הקב"ה במאי עסקתם אומרים לפניו רבש"ע הרבה שווקים תקנינו הרבה מרחצאות עשינו הרבה כסף וזהב הרבינו וכולם לא עשינו אלא בשביל ישראל כדי שיתעסקו בתורה האמר להם הקב"ה שוטים שבעולם כל מה שעשיתם לצורך עצמכם עשיתם תקנתם שווקים להושיב בהן זונות מרחצאות לעדן בהן עצמכם כסף וזהב שלי הוא שנאמר (חגי ב, ח) לי הכסף ולי הזהב נאם ה' צבאות וכלום יש בכם מגיד זאת שנאמר מי בכם יגיד זאת ואין זאת אלא תורה שנאמר (דברים ד, מד) וזאת התורה אשר שם משה מיד יצאו בפחי נפש
First, the members of the Roman Empire enter. The Holy One, Blessed be He, says to them: With what did you occupy yourselves? They say before Him in response: Master of the Universe, we have established many marketplaces, we have built many bathhouses, and we have increased much silver and gold. And we did all of this only for the sake of the Jewish people, so that they would be free to engage in Torah study. 5The Holy One, Blessed be He, says to them: Fools of the world! Are you attempting to deceive Me? Everything that you did, you did for your own needs. You established marketplaces to place prostitutes in them; you built bathhouses for your own enjoyment; and as for the silver and gold that you claim to have increased, it is Mine, as it is stated: Mine is the silver, and Mine the gold, said the Lord of hosts (Haggai 2:
. 6Is there no one among you who can declare that they have studied this Torah? This is the meaning of the continuation of the verse from Isaiah, as it is stated: Who among them can declare this? (Isaiah 43:9). And this is referring to nothing other than the Torah, as it is stated: And this is the Torah that Moses set before the children of Israel (Deuteronomy 4:44), and whoever did not engage in its study does not receive reward. Immediately, the members of the Roman Empire leave disappointed.
We see from the Gemara that if one does something with evil intentions, then one still gets zero schar for any good that may have come out through their actions.