Can't get consistent magnitude response in MATLAB
As already mentioned by @Fat32 and @Florent Ecochard what your observing is a resolution issue with the produced plots. By default (e.g. using freqz without additional input arguments) 8192 points are used to plot the filter response; using less points, as done in you method 2, results in the observed behavior.

See the example code and figures below for an illustration:

%% Define Notch Filter
%
Fs     = 500; 
Fnotch =  50; 
BW     =   1; 
Apass  =   1; 

[b, a] = iirnotch(Fnotch/(Fs/2), BW/(Fs/2), Apass);
Hd     = dfilt.df2(b, a);

%% Plot Response

% method 1
% -&gt; FREQZ default settings
%
[H1,F1] = freqz(Hd);
F1      = F1 * (Fs/(2*pi));  % convert to Hz / account for frequency normalization

% method 2
% -&gt; Use frequency axis of 2048 points.
%
fs      = 500;
f_range = linspace(0,fs/2,2048);

[H2,F2] = freqz(Hd,f_range,fs);


% method 3
% -&gt; Use frequency axis of 8192 points (same number as used in example 1).
%
fs      = 500;
f_range = linspace(0,fs/2,8192);

[H3,F3] = freqz(Hd,f_range,fs);


figure;
plot(F1,20*log10(abs(H1)),...         
     F2,20*log10(abs(H2)),...
     F3,20*log10(abs(H3)) ...
    )
xlabel('f / Hz')
ylabel('|Hd| / dB')
legend('method 1 (freqz default)','method 2 (2048 points)','method 3 (8192 points)')


This then results in the following plots: