> I have table like below <<
Actually you don't have any tables at all! By definition, a table must have a key and none of your declarations can ever have a key because all the columns can be null. You also don't seem to know that the only format permitted for DATE NOT NULLs in ANSI-ISO standard SQL (and a lot of other ISO standards) is 'yyyy-mm-dd' and not your local ambiguous dialect. Considering this is the second most common ISO standard on earth after the metric system, you really should know if you're going to work in IT. You also don't seem to note that you can declare the entire table with instructor using the standard ANSI ISO syntax.
I'm going to make a guess that each of those columns in your report table are actually months, and not dates. The problem is that SQL Server does not have interval data types (the ANSI/ISO standards and other SQL products do).
I have found that stealing the syntax from MySQL is very useful. It has also been proposed as an extension to the ISO 8601 standards, but it is not official yet essential you take the original ISO standard and use double zeros in the day field for a month or double zeros in the month and day field for the year as an interval. Here's a rewrite of your DDL:
CREATE TABLE Vouchers
(voucher_nbr VARCHAR(20) NOT NULL,
voucher_month NOT NULL CHAR(10) NOT NULL
CHECK(voucher_month LIKE '[01][0-9][0-9][0-9]-[01][0-9]-00'), -- study this carefully
PRIMARY KEY (voucher_nbr, voucher_month), -- this is not optional !
procedure_name CHAR(1) NOT NULL CHECK (procedure_name IN ('A', 'B'))
);
Did you know that "procedure" is a reserved word in SQL should never be a table name?
CREATE TABLE Voucher_Report -- notice the use of double quotes
(voucher_nbr VARCHAR(20),
"2021-01-00" CHAR(1) NOT NULL,
"2021-02-00" CHAR(1) NOT NULL,
"2021-03-00" CHAR(1) NOT NULL,
"2021-04-00" CHAR(1) NOT NULL,
"2021-05-00" CHAR(1) NOT NULL);
INSERT INTO Vouchers
VALUES
('1001', '2021-01-00', 'A'),
('1001', '2021-02-00', 'A'),
('1001', '2021-03-00', 'B'),
('1001', '2021-04-00', 'A'),
('1001', '2021-05-00', 'A'),
('1002', '2021-01-00', 'A'),
('1002', '2021-02-00', 'A'),
('1002', '2021-03-00', 'B'),
('1002', '2021-04-00', 'B'),
('1003', '2021-01-00', 'A'),
('1003', '2021-02-00', 'B'),
('1003', '2021-03-00', 'A'),
('1003', '2021-04-00', 'B'),
('1003', '2021-05-00', 'B'),
('1004', '2021-01-00', 'A'),
('1004', '2021-02-00', 'A'),
('1004', '2021-03-00', 'B'),
('1004', '2021-04-00', 'B'),
('1004', '2021-05-00', 'B');
INSERT INTO Voucher_Report
VALUES ('1001', 'A', 'A', 'B', 'A', 'A'), ('1003', 'A', 'B', 'A', 'B', 'B');
in the above Voucher_Report voucher_nbr=1001 the procedure 'A' starts. Again the procedure of voucher_nbr = 1001 changes to 'B' on '03-01-2001'.
if any value changes from one value to another again the previous values should not come.
in the above example voucher_nbr 1001 and 1003 is happened. I need that record [sic - rows are nothing like records!] .
> The date are dynamically changed <<
Not in RDBMS! A column name is an attribute, not the header on a nonrelational report. This is as silly as having the attribute "automobile_color" switch over to "airplane_weight"; each attribute is fixed and does not change. This is one of the basic principles of logic too.
Again, guessing at what you want, this would seem to be a PIVOT operation that turns a relational table into a nonrelational spreadsheet or report. Personally, I would prefer to use a report tool of some kind for this.