In a heavy bottomed saucepan, whisk together the sugar and cornstarch. Add the water and cook over medium heat, stirring constantly with a silicone spatula.
Once the mixture has boiled and thickened (but not darkened too much into a caramel), remove from the heat and stir in the butter.
Add the lime juice and tequila and whisk it together.
Allow to cool completely before using. If it's not thick enough once it's cooled, you can try heating it in the microwave for 30-second intervals until it's thickened more. (But then you'll have to let it cool again before using.)
Store in an airtight container in the refrigerator for up to 2 weeks.