Standard deviation is varying with change in amplitude of DC signal I am trying to make sense of the below code. I am taking a large sample so that I get good estimates for standard deviation. 

N = 25;
h1 = ones(1, N)./N;
L = 1000000;
s = ones(1, L);
n = 0.1*randn(1, L);
x = s + n;
stdx = std(x);
y = filter(h1,1,x);
stdy = std(y);


This code will give me stdx = 0.1 and stdy = 0.02, which is expected since $\sigma_y=\sigma_x/{\sqrt{N}}$as we are essentially doing an average filter.

But giving more amplitude to the signal  s = 10*ones(1, L); and running the same code above is giving me a stdy = 0.0344. Shouldn't the standard deviation be same in both the cases since the signal s has no variance?
I believe your intuition is correct.

The filter you're using is a low pass filter with a DC gain of 1. Without seeing the output of the filtering operation, I suspect that you're seeing the effect of initial conditions in the filter: getting from 0 to 1 in your first instance takes fewer samples than getting from 0 to 10 in your second.

To test this, try taking the middle $L/2$ of your filtered signal and see what std(y(L/4:3*L/4) is then.