I once unlocked bootloader of my samsung a50 and due to that i had lots of problem,and for that i took my phone to store and told them to flash my phone ,unfortunately i am having an error for some of the samsung apps that this phone is rooted..
Can there be any chance that the phones apps can be used again ?
So basically, the knox counter should be set to 0X0 again. So even of you flash stock, it doesn't reset knox counter. However there are methods you can try which you can find on xda. I would not recommend fiddling too much with knox as you might end up bricking your device.
if you flash a stock firmware you don't lock your boot loader again.. for samsung you can't lock your bootloader after its unlocked cuz it has tripped know and if you want the knox back to normal you'll have to change your whole motherboard