Use of stencil Ref, Comp and Pass

Does anyone know how can you make these lines of code in a material?

Stencil
		{
			Ref 1
			Comp always 
			Pass replace 
		}

Stencil
		{
			Ref 1
			Comp notequal
			Pass keep
		}

Also, do you know how to change the render queue in a material?

There are set from the engine code, not material.
You cannot change queue in material. You can however change queue per object by adjusting translucency sort priority.

I think I had to be more concise. What I wanted to do in a material was this:
Shader “Mask”
{
Properties
{
_MainTex(“Diffuse”, 2D)=“white”{}
}
SubShader
{
Tags{“Queue”=“Geometry-1”}

		ColorMask 0
		ZWrite off

		Stencil
		{
			Ref 1
			Comp always 
			Pass replace 
		}

		CGPROGRAM
		#pragma surface surf Lambert

		sampler2D _MainTex;

		struct Input
		{
			float2 uv_MainTex;
		};

		void surf (Input IN, inout SurfaceOutput o)
		{
			fixed4 c = tex2D (_MainTex, IN.uv_MainTex);
			o.Albedo = c.rgb;
		}
		ENDCG
	}
	FallBack "Diffuse"
}

And this:

Shader "Wall" 
{
	Properties
	{
		_MainTex("Diffuse", 2D)="white"{}
	}
	SubShader
	{
		Tags{"Queue"="Geometry"}

		Stencil
		{
			Ref 1
			Comp notequal
			Pass keep
		}

		CGPROGRAM
		#pragma surface surf Lambert

		sampler2D _MainTex;

		struct Input
		{
			float2 uv_MainTex;
		};

		void surf (Input IN, inout SurfaceOutput o)
		{
			fixed4 c = tex2D (_MainTex, IN.uv_MainTex);
			o.Albedo = c.rgb;
		}
		ENDCG
	}
	FallBack "Diffuse"
}

Any ideas of how to do it?