How can I prevent texture stretching while scaling a mesh?

Thank you sooo much for this, u saved me A LOT of time !!!