How to control Spread factor while we keep in OTA

I am trying to measure the current consumption in SF9 with OTA configuration in EU868. what i observed is : even though i dont change the distance between the gateway and node after a while( 3-4 hours) the spread factor changes from SF9 to SF7. is there a way to control the spread factor? via any kinds of rf shields/ keeping some material around the gateway any materials,etc?

The mechanism that changes the spreading factor to optimize energy consumption and bandwidth usage is called ADR. If you disable it your end device should not switch.

Given the timing (3-4 hours) combined with SF9 you might be uplinking too often for TTN. Do you observe the FUP and keep within its limits?

As Jac says but consumption of what? Millions of SX127x & 126x devices have shipped, datasheets provide details and to best of my knowledge there have been no notable anomolies! If testing a subsystem, measure that under dummy TX/RX conditions and add in characterised values then you dont need to use spectrum or wrangle device settings? Just a thought…

And as ever, what is the Why?

Why do you need to do this and so very specifically on a particular SF?

Without context your question is only going to get vague answers.

And as I’m sure you know, the current consumption is the same for a setup for all SF’s, it’s just the duration that changes.

Based on current consumption I am trying to estimate the battery life.
I am measuring current consumption of the overall product.

Even in OTA it will not change?

This ^^^

Just buy a Nordic PPK2, you run the device, it logs the power used, job done.

What you really want to know is the energy-consumtion. Therefore the transmitter “on” time is important and this time is influenced by the SF. The lower the SF the lower the time and the energy -consumption.
This is how ADR works, energy saving by keeping the transmit-time as short as possible.