Aragorn, using the name Thorongil, served under Ecthelion, Steward of Gondor, father of Denethor II, and grandfather of Boromir and Faramir before disappearing four years before Denethor II assumed the title of Steward of Gondor. Did Denethor II know that Aragorn, when he came to Gondor during the War of the Ring, was the same person as Thorongil?
Some believed he did, but it was never confirmed
This is discussed in Appendix A:
[M]any believed that Denethor, who was subtle in mind and looked further and deeper than other men of his day, had discovered who this stranger Thorongil in truth was, and suspected that he and Mithrandir designed to supplant him.
Return of the King Appendix A "Annals of the Kings and Rulers" I: "The Númenórean Kings" (iv) Gondor and the Heirs of Anárion The Stewards
I'm afraid you have your timeline mixed up. Aragorn only entered Minas Tirith during the War of the Ring after the siege was ended. By that time, Denethor had already committed suicide. So the answer to "Did Denethor II recognize Aragorn when he came to Gondor during the War of the Ring?" is unequivocally no.
Would he have recognized him? I doubt it. Denethor was young when they met. If you saw someone who looked remarkably like someone from your past decades later, would you assume they were the same person? Or would you mark it up to coincidence?