• I don't know.... I've run both your inline and variable procedures and on my machine they both take about 470ms, give or take a few ms. In fact, if anything I've found the variable method slightly slower by up to 50ms.

    Did you dropcleanbuffers before running each procedure? If not then you might find that the cached results are interfering with your numbers.

    Also, if you check out the io statistics, more logical reads are performed with the variable method.

    I'm not sure I see the benefit in running the exact same query twice, as you're doing in the variable method. Unless I'm missing something, which is quite possible 😉